Thursday, October 19, 2006

the high/low game

Employee of the Month (2006): a box boy at costco tries to do good at work to impress jessica simpson. the boss looks way too much like steve carell. there really is no beginning to this movie. it just kind of starts. the jorge character (napoleon's pedro) was really funny as the side kick, but most of the other supporting characters weren't that great. the plot is really weak. there were a lot of jokes that just weren't very funny at all. but jessica simpson looked really good, which usually made the movie a lot more interesting when she'd stand there and looked mental, but hot. cheesy acting and characters that were unbelievable. really cheesy and lame screenplay. it was still somewhat fun to see though. don't see.
disappointing, C-

when does the freaking time change already? i'm freaking sick of it getting dark at like six.

my last homework assignment for java included creating a program for a "high/low game". the program picks a number, you guess, and it tells you if you are high or low until you win or give up. pretty blah program, but i was stoked when i finally got it working for me. so stoked that i decided to share it. enjoy:

/*
* Main.java
*
* Created on October 14, 2006, 10:25 PM
*
* @author Ethan Chambers
*/

import staugIO.StaugIO; //IMPORT IO
import java.util.Random; //IMPORT RANDOM NUMBER UTIL


class HighLow
{
//VARIABLES AND OBJECTS
private int choice = 0; //IF USER WILL PLAY
private StaugIO io = new StaugIO(); //IO OBJECT
private Random generator = new Random(); //RANDOM NUMBER OBJECT
private int random = 0; //RANDOM NUMBER
private int guess = 0; //USER'S GUESS
private int count = 0; //NUMBER OF GUESSES

public HighLow() //CONSTRUCTOR METHOD
{

}//END CONSTRUCTOR METHOD

public void play() //play METHOD
{
choice = io.readInt("Would you like to play the High-Low game?" +
"\nEnter 1 to play or 2 to quit: ");


switch (choice)
{
case 1 : generateNumber();
highLowTest();
break;
case 2 : io.writeInfo("Game over.");
break;
default : io.writeInfo("Invalid entry.");
break;
}//END switch
}//END play() METHOD

public int choice(int a) //choice() METHOD
{
return choice;

}//END choice() METHOD

public void generateNumber() //generateNumber() METHOD
{
random = generator.nextInt(100) + 1;
System.out.println(random); //PRINTS RANDOM NUMBER
}//END generateNumber()

public void highLowTest() //highLowTest()
{
guess = io.readInt("Guess a number between 1 and 100." +
"\nNumber of guesses: " + count +
"\nEnter 0 to quit.");
++count;
System.out.println(count); //PRINTS OUT NUMBER OF GUESSES
if(guess == 0)
{
io.writeInfo("Loser. The number was: " + random);
count = 0;
}
else
if(guess > 100)
{
io.writeInfo("Invalid entry. Try again.");
highLowTest();
}
else
if(guess < 0)
{
io.writeInfo("Invalid entry. Try again.");
highLowTest();
}
else
if(guess > random)
{
io.writeInfo("Too high. Guess again");
highLowTest();
}
else
if(guess < random)
{
io.writeInfo("Too low. Guess again");
highLowTest();
}

else


{
io.writeInfo("Good job! You win." +
"\nNumber of guesses: " + count);
count = 0;
}

//END while

}//END highLowTest()

}//END HighLow CLASS

public class Main
{

public static void main(String[] args)
{
HighLow test = new HighLow(); //test OBJECT
int toPlay = 0; //PLAY OR QUIT PROGRAM


do
{
test.play();
toPlay = test.choice(toPlay);
System.out.println(toPlay);
}
while(toPlay != 2);

//EXIT PROGRAM
System.exit(0);

}// END main() METHOD
}//END MAIN class

5 comments:

Anonymous said...

Spring ahead, Fall back...it will be dark at 5:00 instead of 6:00 when the time change goes in effect.

Ethan Allen said...

yeah i could never get those straight. it's certainly a shame. you'd think after all these years i'd get used to the sun going down after 4 pm. what a rip.

Anonymous said...

your review of Employee of the Month, along with every other review you have made is absolutely horrible. You need to stop doing these reviews because you are terrible at them, and basically your suggestions are awful.

Ethan Allen said...

that's exactly what i was going for.

Anonymous said...

ethan- it's going to be getting dark one hour earlier. so you know. it happens this saturday night. email me your number so we can meet up in three weeks when i'm in denver. if your lucky you might even get to drive me to colorado springs! if you wanted to. it'd be like reliving our troad trip to NM to see =w= play, oh so long ago.

-matthew